package com.example.demo.LeetCode.string;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class MaxVowels {
  public static int  solution(String str ,int k){
      List<Character> list = Stream.of('a','o','i','u','e').collect(Collectors.toList());
      char[] arr = str.toCharArray();
      int res = 0;
      for (int i = 0 ; i < k ; ++i){
          res+= isVowel(list,arr[i]);
      }
      int ans  = res;
      for (int i = k ; i < arr.length ; ++i){
         res += isVowel(list,arr[i]) - isVowel(list,arr[i - k]);
         ans = Math.max(ans,res);
      }
      return ans;
  }

  public static int isVowel( List<Character> list,char c){
      System.out.println(c);
      return list.contains(c) ? 1 : 0;
  }

    public static void main(String[] args) {
        String str = "sddiaddcfd";
        System.out.println(solution(str,3));
    }
}
